/**
 * Created by Administrator on 2016/3/21.
 */
var styleDirectives = angular.module('StyleDirectives');
styleDirectives.directive("liClassSwitch", function() {
    return {
        restrict: 'A',
        replace: 'false',
        link:function(scope,elem,attrs){
            elem.find('li').bind('click',function(){
                elem.find('li').removeClass('active');
                angular.element(this).addClass('active');
            })
        }
    };
});
styleDirectives.directive("tableClassSwitch", function() {
    return {
        restrict: 'A',
        replace: 'false',
        link:function(scope,elem,attrs){
            elem.on("click",function( e ){
                elem.find('tr').removeClass('active');
                angular.element(e.target).parent('tr').addClass('active');
            })
        }
    };
});
styleDirectives.directive("aClassSwitch", function() {
    return {
        restrict: 'A',
        replace: 'false',
        link:function(scope,elem,attrs){
            elem.on("click",function( e ){
                elem.find('a').removeClass('active');
                angular.element(e.target).addClass('active');
            })
        }
    };
});


